|
|
|
| | | |
|
|
|
|
Figure 16.8
Breakpoints are highlighted in red. |
|
|
|
|  | You can also set a breakpoint by selecting Toggle Breakpoint from the Debug menu, clicking the hand icon on the Debug toolbar. |
|
|
|
|
|
|
After a breakpoint is set, you can run the application normally. When Visual Basic hits that line, it automatically puts you in break mode. At this point, you can change your code, inspect variables, or do anything else needed to make your application run correctly. Of course there are some changes that may require to you stop the execution of your code. For example, if you change the type of a parameter or variable, or you declare a new variable, you will need to stop execution and reexecute from the beginning of your program. |
|
|
|
|
|
|
|
|
Breakpoints are cleared after the VBP file is unloaded. There is no way to save breakpoints. |
|
|
|
|
|
|
|
|
The Stop statement can be placed anywhere in your code where you want execution to stop and want to enter the debug mode. Stop is an executable statement and is therefore saved with your code. This is the primary advantage of using the Stop statementits saved when you leave Visual Basic. |
|
|
|
|
|
|
|
|
However, you want to make sure you remove these statements prior to making an EXE file. They act just like the End statement in an EXE file in that they immediately halt your program. Heres an example: |
|
|
|
|
|